<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
    <button v-on:click="sayHi">click me</button>
</div>
<script>
    const v = new Vue({
        el: "#app",
        data: {
            message: "vue真好用"
        },
        // 方法必须定义在vue的实例的methods对象中
        methods: {
            sayHi: function () {
                // this指向当前vue实例
                alert(this.message);
            }
        }
    });
</script>

</body>
</html>
